package com.dkm.orproject.dkmoa.service.serviceimpl;

import com.dkm.orproject.dkmoa.dao.OaMessageMapper;
import com.dkm.orproject.dkmoa.domain.OaMessage;
import com.dkm.orproject.dkmoa.domain.OaPersonnel;
import com.dkm.orproject.dkmoa.service.OaMessageService;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName : OaMessageServiceImpl  //类名
 * @Description : 流程通知实现接口  //描述
 * @Author : 易嵘  //作者
 * @Date: 2020-09-16 10:38  //时间
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class OaMessageServiceImpl implements OaMessageService {

    @Resource
    OaMessageMapper messageMapper;

    @Override
    public List<OaMessage> findAll(OaPersonnel personnel) {
        return messageMapper.findAll(personnel.getPkPersonnelId());
    }

    @Override
    public List<OaMessage> findAllBacklog(OaPersonnel personnel) {
        PageHelper.startPage(1,10);
        return messageMapper.findAllBacklog(personnel.getPkPersonnelId());
    }

    @Override
    public List<OaMessage> findAllToBeRead(OaPersonnel personnel) {
        PageHelper.startPage(1,10);
        return messageMapper.findAllToBeRead(personnel.getPkPersonnelId());
    }

    @Override
    public List<OaMessage> findAllHaveDone(OaPersonnel personnel) {
        PageHelper.startPage(1,10);
        return messageMapper.findAllHaveDone(personnel.getPkPersonnelId());
    }
}
